﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Register : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        AccountManager am = new AccountManager();
        string usename = txtUserName.Text;
        string password = txtPassword.Text;
        string fullname = txtFulname.Text;
        string address = txtAddress.Text;
        string email = txtEmail.Text;
        string phone = txtPhone.Text;
        int power = 1;
        int addUser = am.addUser(usename, password, fullname, address, email, phone, power);
        if (addUser > 0)
        {
            Response.Redirect("Message.aspx");
        }
        else
        {
            lblMessage.Text = "Register failed.";
        }
    }
}